package fei.yuzhi.com.loveflowers.fragment.firstpagefragment.detail.baseinformation;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import fei.yuzhi.com.loveflowers.R;
import fei.yuzhi.com.loveflowers.fragment.firstpagefragment.detail.DetailActivity;
import fei.yuzhi.com.loveflowers.fragment.firstpagefragment.detail.goodsdetail.GoodsDetailFragment;
import fei.yuzhi.com.loveflowers.utils.DragLayout;

/**
 * Created by My on 2016/10/20.
 */
public class BaseAll extends Fragment {
    @BindView(R.id.first)
    FrameLayout first;
    @BindView(R.id.second)
    FrameLayout second;
    @BindView(R.id.draglayout)
    DragLayout draglayout;
    private BaseInformationFragment fragment1;
    private GoodsDetailFragment fragment3;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable
    Bundle savedInstanceState) {
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_baseall, null);
        ButterKnife.bind(this, view);
        initView();
        return view;
    }

    private void initView() {
        fragment1 = new BaseInformationFragment();
        fragment3 = new GoodsDetailFragment();
        getActivity().getSupportFragmentManager().beginTransaction()
                .add(R.id.first, fragment1).add(R.id.second, fragment3)
                .commit();

        DragLayout.ShowNextPageNotifier nextIntf = new DragLayout.ShowNextPageNotifier() {
            @Override
            public void onDragNext() {
                fragment3.initView();
            }
        };
        draglayout.setNextPageListener(nextIntf);
    }
}
